package com.block.datapush.spread.factory;

import com.block.common.util.ApplicationContextUtil;
import com.block.datapush.spread.service.ISpreadService;
import com.block.datapush.spread.service.type.GzhSmsSpreadService;

import java.util.HashMap;
import java.util.Map;

public class SpreadFactory {

    private static Map<String, Class<? extends ISpreadService>> serviceMap = new HashMap<>();
    static {
        serviceMap.put("GZH_SMS", GzhSmsSpreadService.class);
    }

    public static ISpreadService getService(String filterKey){
        if (serviceMap.containsKey(filterKey)){
            Class<? extends ISpreadService> aClass = serviceMap.get(filterKey);
            return ApplicationContextUtil.getBean(aClass);
        }
        return null;
    }}
